import java.sql.*;
import java.util.ResourceBundle;

public class one{
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
//        DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver()); // 注册驱动

        ResourceBundle resourceBundle =  ResourceBundle.getBundle("jdbc");
        Class.forName(resourceBundle.getString("driverclass")); // 反射注册驱动

        String url = resourceBundle.getString("url");
        String password = resourceBundle.getString("password");
        String user =  resourceBundle.getString("user");
        Connection connection = DriverManager.getConnection(url, user, password);
        //链接数据库
//        System.out.println(connection);

        Statement statement = connection.createStatement();// 获取数据库操作对象

// 执行sql
        String sql = "delete from tb_student where name = 'Wccc'";
        int row = statement.executeUpdate(sql);

        System.out.println(row);

        // 关闭数据库
        if (statement != null)
        statement.close();
        if (connection != null)
        connection.close();


    }
}
